package com.example.controller;

import com.example.entity.supervision.PlanDetail;
import com.example.service.PlanDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * Created by simon on 2018/8/7.
 * 计划明细
 */
@RestController
@RequestMapping("api/planDetail")
public class PlanDetailController {

    @Autowired
    PlanDetailService planDetailService;

    /**
     * 新增计划
     * @param map
     * @return
     */
    @RequestMapping(value = "/addPlanDetail", method = RequestMethod.POST)
    Map<String, Object> add(@RequestBody PlanDetail map) {
        return planDetailService.add(map);
    }


    /**
     * 删除 计划
     * @param map
     * @return
     */
    @RequestMapping(value = "/deletePlanDetail", method = RequestMethod.POST)
    Map<String, Object> delete(@RequestBody Map map) {
        return planDetailService.delete(map);
    }


    /**
     *  修改 计划
     * @param map
     * @return
     */
    @RequestMapping(value = "/updatePlanDetail", method = RequestMethod.POST)
    Map<String, Object> update(@RequestBody Map map) {
        return planDetailService.update(map);
    }


    /**
     *  发布 计划
     * @param map
     * @return
     */
    @RequestMapping(value = "/publishPlanDetail", method = RequestMethod.POST)
    Map<String, Object> publishPlanDetail(@RequestBody Map map) {
        return planDetailService.publish(map);
    }

    /**
     *  查询 计划
     * @param map
     * @return
     */
    @RequestMapping(value = "/queryPlanDetail", method = RequestMethod.POST)
    Map<String, Object> query(@RequestBody Map map) {
        return planDetailService.query(map);
    }


    /**
     * 新增计划excel
     * @param file
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    Map<String, Object> inExcel(@RequestBody MultipartFile file, @RequestParam("id") String planDictId) {
        return planDetailService.inExcel(file, planDictId);
    }

    /**
     *  查询项目列表
     * @param map
     * @return
     */
    @RequestMapping(value = "/queryProgramList", method = RequestMethod.POST)
    Map<String, Object> queryProgramList(@RequestBody Map map) {
        return planDetailService.queryProgramList(map);
    }

}
